<template>
  <div class="h-home-header">
    <div class="h-header-left">
      <span class="iconfont h-back-icon">&#xe624;</span>
    </div>
    <div class="h-header-input">
      <span class="iconfont">&#xe632;</span>
      输入城市景点/游玩主题
    </div>
    <router-link to="/city">
      <div class="h-header-right">
        {{this.city}}
        <span class="iconfont arrow-icon">&#xe6aa;</span>
      </div>
    </router-link>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    // 将vuex的公用数据映射到计算属性
    ...mapState(['city'])
  }
}

</script>

<style lang="stylus" scope>
/* *@符号相当于src目录，在css文件引入其他css加上~
 // @import '../../../../assets/styles/varibles.styl';
*/
@import '~@/assets/styles/varibles.styl';

/* * 1rem == 50px */
.h-home-header {
  /* 使header盒子里面的属性横向铺开 */
  display: flex;
  /* *使字体垂直居中 */
  height: $headerHeight;
  line-height: $headerHeight;
  background: $bgColor;
  color: #fff;

  /* *.header-left 浮动到段落左侧 */

  .h-header-left {
    margin-left: 0.16rem;
    width: 0.64rem;
    float: left;

    .h-back-icon {
      text-align: center;
      font-size: 0.36rem;
    }
  }

  /* *input在剩余宽度下，铺满 */

  .h-header-input {
    flex: 1;
    /* *height 和 line-heighe 把字体垂直居中 */
    height: 0.64rem;
    line-height: 0.64rem;
    /* *距外边距顶部6px */
    margin-top: 0.12rem;
    margin-left: 0.2rem;
    padding-left: 0.2rem;
    background: #fff;
    border-radius: 0.1rem;
    /* *字体显示出来 */
    color: #ccc;
  }

  .h-header-right {
    /* *min-width 1.04rem padding 0 0.1rem */
    min-width 1.04rem
    padding 0 0.1rem
    height: $headerHeight;
    float: right;
    text-align: center;
    color: #FFFFFF;

    .h-arrow-icon {
      // padding-top: 0.1rem;
    }
  }
}
</style>
